execute as @p at @s if data entity @s Inventory[{id:"minecraft:written_book",tag:{title:"Explorer's Book"}}] run 

give @s minecraft:villager_spawn_egg{display:{Name:'[{"text":"

Exchanger

"}]'},EntityTag:{id:villager,VillagerData:{
profession:cartographer,
level:99,
type:plains},
CustomName:"\"

Exchanger

\"",
Tags:["SKYWIZA","LOTW-ally"],
Offers:{Recipes:[





{buy:{
id:iron_nugget,Count:64,
tag:{display:{Name:"{\"text\":\"Silver Nugget\"}",
Lore:["{\"text\":\"--------------------\"}",
"{\"text\":\"- The currency of SKYWIZA\"}",
"{\"text\":\"- 64 silver nugget can exchange to 1 crystal nuggets\"}",
"{\"text\":\"--------------------\"}"]}}}
,

buyB:{
id:air,Count:1}
,

sell:{
id:prismarine_crystals,Count:1,
tag:{display:{Name:"{\"text\":\"Crystal Nuggets\"}",
Lore:["{\"text\":\"--------------------\"}",
"{\"text\":\"- The currency of SKYWIZA\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 64 silver nugget\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 1 emerald\"}",
"{\"text\":\"- 64 crystal nuggets can exchange to 1 white crystal\"}",
"{\"text\":\"--------------------\"}"]}}}
,rewardExp:0b,maxUses:9999999},





{buy:{
id:prismarine_crystals,Count:1,
tag:{display:{Name:"{\"text\":\"Crystal Nuggets\"}",
Lore:["{\"text\":\"--------------------\"}",
"{\"text\":\"- The currency of SKYWIZA\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 64 silver nugget\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 1 emerald\"}",
"{\"text\":\"- 64 crystal nuggets can exchange to 1 white crystal\"}",
"{\"text\":\"--------------------\"}"]}}}
,

buyB:{
id:air,Count:1}
,

sell:{
id:iron_nugget,Count:64,
tag:{display:{Name:"{\"text\":\"Silver Nugget\"}",
Lore:["{\"text\":\"--------------------\"}",
"{\"text\":\"- The currency of SKYWIZA\"}",
"{\"text\":\"- 64 silver nugget can exchange to 1 crystal nuggets\"}",
"{\"text\":\"--------------------\"}"]}}}
,rewardExp:0b,maxUses:9999999},





{buy:{
id:prismarine_crystals,Count:64,
tag:{display:{Name:"{\"text\":\"Crystal Nuggets\"}",
Lore:["{\"text\":\"--------------------\"}",
"{\"text\":\"- The currency of SKYWIZA\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 64 silver nugget\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 1 emerald\"}",
"{\"text\":\"- 64 crystal nuggets can exchange to 1 white crystal\"}",
"{\"text\":\"--------------------\"}"]}}}
,

buyB:{
id:air,Count:1}
,

sell:{
id:quartz,Count:1,
tag:{display:{Name:"{\"text\":\"White Crystal\"}",
Lore:["{\"text\":\"--------------------\"}",
"{\"text\":\"- The currency of SKYWIZA\"}",
"{\"text\":\"- 1 white crystal can exchange to 64 crystal nuggets\"}",
"{\"text\":\"--------------------\"}"]}}}
,rewardExp:0b,maxUses:9999999},





{buy:{
id:quartz,Count:1,
tag:{display:{Name:"{\"text\":\"White Crystal\"}",
Lore:["{\"text\":\"--------------------\"}",
"{\"text\":\"- The currency of SKYWIZA\"}",
"{\"text\":\"- 1 white crystal can exchange to 64 crystal nuggets\"}",
"{\"text\":\"--------------------\"}"]}}}
,

buyB:{
id:air,Count:1}
,

sell:{
id:prismarine_crystals,Count:64,
tag:{display:{Name:"{\"text\":\"Crystal Nuggets\"}",
Lore:["{\"text\":\"--------------------\"}",
"{\"text\":\"- The currency of SKYWIZA\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 64 silver nugget\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 1 emerald\"}",
"{\"text\":\"- 64 crystal nuggets can exchange to 1 white crystal\"}",
"{\"text\":\"--------------------\"}"]}}}
,rewardExp:0b,maxUses:9999999},





{buy:{
id:prismarine_crystals,Count:1,
tag:{display:{Name:"{\"text\":\"Crystal Nuggets\"}",
Lore:["{\"text\":\"--------------------\"}",
"{\"text\":\"- The currency of SKYWIZA\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 64 silver nugget\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 1 emerald\"}",
"{\"text\":\"- 64 crystal nuggets can exchange to 1 white crystal\"}",
"{\"text\":\"--------------------\"}"]}}}
,

buyB:{
id:air,Count:1}
,

sell:{
id:emerald,Count:1
},rewardExp:0b,maxUses:9999999},





{buy:{
id:emerald,Count:1}
,

buyB:{
id:air,Count:1}
,

sell:{
id:prismarine_crystals,Count:1,
tag:{display:{Name:"{\"text\":\"Crystal Nuggets\"}",
Lore:["{\"text\":\"--------------------\"}",
"{\"text\":\"- The currency of SKYWIZA\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 64 silver nugget\"}",
"{\"text\":\"- 1 crystal nuggets can exchange to 1 emerald\"}",
"{\"text\":\"- 64 crystal nuggets can exchange to 1 white crystal\"}",
"{\"text\":\"--------------------\"}"]}}}
,rewardExp:0b,maxUses:9999999}










]},Invulnerable:1b,DeathLootTable:"minecraft:empty",
ArmorItems:[{},{},{},{id:"emerald",Count:1b}]}}